/* Copyright (c) 2002-2009 Grupo e-Gen.  All rights reserved.
 *
 * ====================================================================
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation;
 * either version 2.1 of the License, or any later version.
 * 
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
 * See the GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 * MA 02111-1307 USA
 * 
 */

package br.com.managerprojectplugin.view;

import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;

import br.com.managerprojectplugin.model.Usecase;

/**
 * Class: UseCase
 *   
 * @author Grupo e-Gen 
 * @version 1.0 (07/07/2012)
 * @since 1.0 (14/07/2012)
 */
public class UseCaseView extends ViewPart {

	public static final String USECASEVIEW_ID = "UseCaseView";
	private TreeViewer treeViewer;

	@Override
	public void createPartControl(Composite parent) {
		Usecase[] uc = new Usecase[5];
		for (int i = 0; i < uc.length; i++) {
			uc[i] = new Usecase();
			uc[i].setCaseParent("CaseParent");
			uc[i].setEstado("solteiro");
			uc[i].setInicio("hoje");
			uc[i].setNome("elton");
			uc[i].setNomeProjeto("chartner");
			uc[i].setProjetoDesc("novo");
			uc[i].setTerminno("ontem");
		}
		treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
		treeViewer.setContentProvider(new UseCaseContentProvider());
		treeViewer.setLabelProvider(new UseCaseLabelProvider());
		treeViewer.setInput(uc);
		treeViewer.setAutoExpandLevel(2);
		treeViewer.getTree().setLinesVisible(true);
	}

	@Override
	public void setFocus() {
		treeViewer.getControl().setFocus();
	}

}
